home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Interfaces & Libraries / Interfaces / CIncludes / Editions.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-06  |  14.9 KB  |  421 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Editions.h
  3.  
  4.      Contains:    Edition Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __EDITIONS__
  21. #define __EDITIONS__
  22.  
  23.  
  24. #ifndef __MEMORY__
  25. #include <Memory.h>
  26. #endif
  27. /*    #include <Types.h>                                            */
  28. /*        #include <ConditionalMacros.h>                            */
  29. /*    #include <MixedMode.h>                                        */
  30.  
  31. #ifndef __TYPES__
  32. #include <Types.h>
  33. #endif
  34.  
  35. #ifndef __FILES__
  36. #include <Files.h>
  37. #endif
  38. /*    #include <OSUtils.h>                                        */
  39. /*    #include <Finder.h>                                            */
  40.  
  41. #ifndef __ALIASES__
  42. #include <Aliases.h>
  43. #endif
  44. /*    #include <AppleTalk.h>                                        */
  45.  
  46. #ifndef __DIALOGS__
  47. #include <Dialogs.h>
  48. #endif
  49. /*    #include <Errors.h>                                            */
  50. /*    #include <Menus.h>                                            */
  51. /*        #include <Quickdraw.h>                                    */
  52. /*            #include <QuickdrawText.h>                            */
  53. /*    #include <Controls.h>                                        */
  54. /*    #include <Windows.h>                                        */
  55. /*        #include <Events.h>                                        */
  56. /*    #include <TextEdit.h>                                        */
  57.  
  58. #ifdef __cplusplus
  59. extern "C" {
  60. #endif
  61.  
  62. #if PRAGMA_ALIGN_SUPPORTED
  63. #pragma options align=mac68k
  64. #endif
  65.  
  66. #if PRAGMA_IMPORT_SUPPORTED
  67. #pragma import on
  68. #endif
  69.  
  70.  
  71. enum {
  72. /* resource types  */
  73.     rSectionType                = 'sect',                        /* ResType of saved SectionRecords */
  74. /* Finder types for edition files */
  75.     kPICTEditionFileType        = 'edtp',
  76.     kTEXTEditionFileType        = 'edtt',
  77.     ksndEditionFileType            = 'edts',
  78.     kUnknownEditionFileType        = 'edtu',
  79.     kPublisherDocAliasFormat    = 'alis',
  80.     kPreviewFormat                = 'prvw',
  81.     kFormatListFormat            = 'fmts'
  82. };
  83.  
  84. enum {
  85. /* section types */
  86.     stSubscriber                = 0x01,
  87.     stPublisher                    = 0x0A,
  88.     sumAutomatic                = 0,                            /* subscriber update mode - Automatically     */
  89.     sumManual                    = 1,                            /* subscriber update mode - Manually */
  90.     pumOnSave                    = 0,                            /* publisher update mode - OnSave            */
  91.     pumManual                    = 1,                            /* publisher update mode - Manually */
  92.     kPartsNotUsed                = 0,
  93.     kPartNumberUnknown            = -1,                            /* misc */
  94.     kPreviewWidth                = 120,
  95.     kPreviewHeight                = 120,
  96. /* bits for formatsMask */
  97.     kPICTformatMask                = 1,
  98.     kTEXTformatMask                = 2,
  99.     ksndFormatMask                = 4,
  100. /* pseudo-item hits for dialogHooks 
  101.  the first if for NewPublisher or NewSubscriber Dialogs */
  102.     emHookRedrawPreview            = 150,
  103. /* the following are for SectionOptions Dialog */
  104.     emHookCancelSection            = 160,
  105.     emHookGoToPublisher            = 161,
  106.     emHookGetEditionNow            = 162,
  107.     emHookSendEditionNow        = 162,
  108.     emHookManualUpdateMode        = 163,
  109.     emHookAutoUpdateMode        = 164
  110. };
  111.  
  112. enum {
  113. /* the refcon field of the dialog record during a modalfilter 
  114.  or dialoghook contains one the following */
  115.     emOptionsDialogRefCon        = 'optn',
  116.     emCancelSectionDialogRefCon    = 'cncl',
  117.     emGoToPubErrDialogRefCon    = 'gerr',
  118.     kFormatLengthUnknown        = -1
  119. };
  120.  
  121. /* one byte, stSubscriber or stPublisher */
  122. typedef SignedByte SectionType;
  123.  
  124. /* seconds since 1904 */
  125. typedef unsigned long TimeStamp;
  126.  
  127. /* similar to ResType */
  128. typedef FourCharCode FormatType;
  129.  
  130. /* used in Edition I/O */
  131. typedef Handle EditionRefNum;
  132.  
  133. /* update modes */
  134. /* sumAutomatic, pumSuspend, etc */
  135. typedef short UpdateMode;
  136.  
  137. typedef struct SectionRecord SectionRecord;
  138.  
  139. typedef SectionRecord *SectionPtr, **SectionHandle;
  140.  
  141. struct SectionRecord {
  142.     SignedByte                        version;                    /* always 0x01 in system 7.0 */
  143.     SectionType                        kind;                        /* stSubscriber or stPublisher */
  144.     UpdateMode                        mode;                        /* auto or manual */
  145.     TimeStamp                        mdDate;                        /* last change in document */
  146.     long                            sectionID;                    /* app. specific, unique per document */
  147.     long                            refCon;                        /* application specific */
  148.     AliasHandle                        alias;                        /* handle to Alias Record */
  149.     long                            subPart;                    /* which part of container file */
  150.     SectionHandle                    nextSection;                /* for linked list of app's Sections */
  151.     Handle                            controlBlock;                /* used internally */
  152.     EditionRefNum                    refNum;                        /* used internally */
  153. };
  154. struct EditionContainerSpec {
  155.     FSSpec                            theFile;
  156.     ScriptCode                        theFileScript;
  157.     long                            thePart;
  158.     Str31                            thePartName;
  159.     ScriptCode                        thePartScript;
  160. };
  161. typedef struct EditionContainerSpec EditionContainerSpec;
  162.  
  163. typedef EditionContainerSpec *EditionContainerSpecPtr;
  164.  
  165. struct EditionInfoRecord {
  166.     TimeStamp                        crDate;                        /* date EditionContainer was created */
  167.     TimeStamp                        mdDate;                        /* date of last change */
  168.     OSType                            fdCreator;                    /* file creator */
  169.     OSType                            fdType;                        /* file type */
  170.     EditionContainerSpec            container;                    /* the Edition */
  171. };
  172. typedef struct EditionInfoRecord EditionInfoRecord;
  173.  
  174. struct NewPublisherReply {
  175.     Boolean                            canceled;                    /* O */
  176.     Boolean                            replacing;
  177.     Boolean                            usePart;                    /* I */
  178.     SInt8                            filler;
  179.     Handle                            preview;                    /* I */
  180.     FormatType                        previewFormat;                /* I */
  181.     EditionContainerSpec            container;                    /* I/O */
  182. };
  183. typedef struct NewPublisherReply NewPublisherReply;
  184.  
  185. struct NewSubscriberReply {
  186.     Boolean                            canceled;                    /* O */
  187.     SignedByte                        formatsMask;
  188.     EditionContainerSpec            container;                    /*I/O*/
  189. };
  190. typedef struct NewSubscriberReply NewSubscriberReply;
  191.  
  192. struct SectionOptionsReply {
  193.     Boolean                            canceled;                    /* O */
  194.     Boolean                            changed;                    /* O */
  195.     SectionHandle                    sectionH;                    /* I */
  196.     ResType                            action;                        /* O */
  197. };
  198. typedef struct SectionOptionsReply SectionOptionsReply;
  199.  
  200. typedef pascal Boolean (*ExpModalFilterProcPtr)(DialogPtr theDialog, EventRecord *theEvent, short itemOffset, short *itemHit, Ptr yourDataPtr);
  201. typedef pascal short (*ExpDlgHookProcPtr)(short itemOffset, short itemHit, DialogPtr theDialog, Ptr yourDataPtr);
  202.  
  203. #if GENERATINGCFM
  204. typedef UniversalProcPtr ExpModalFilterUPP;
  205. typedef UniversalProcPtr ExpDlgHookUPP;
  206. #else
  207. typedef ExpModalFilterProcPtr ExpModalFilterUPP;
  208. typedef ExpDlgHookProcPtr ExpDlgHookUPP;
  209. #endif
  210.  
  211. enum {
  212.     uppExpModalFilterProcInfo = kPascalStackBased
  213.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  214.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DialogPtr)))
  215.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(EventRecord*)))
  216.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short)))
  217.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short*)))
  218.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(Ptr))),
  219.     uppExpDlgHookProcInfo = kPascalStackBased
  220.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  221.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  222.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short)))
  223.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(DialogPtr)))
  224.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Ptr)))
  225. };
  226.  
  227. #if GENERATINGCFM
  228. #define NewExpModalFilterProc(userRoutine)        \
  229.         (ExpModalFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppExpModalFilterProcInfo, GetCurrentArchitecture())
  230. #define NewExpDlgHookProc(userRoutine)        \
  231.         (ExpDlgHookUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppExpDlgHookProcInfo, GetCurrentArchitecture())
  232. #else
  233. #define NewExpModalFilterProc(userRoutine)        \
  234.         ((ExpModalFilterUPP) (userRoutine))
  235. #define NewExpDlgHookProc(userRoutine)        \
  236.         ((ExpDlgHookUPP) (userRoutine))
  237. #endif
  238.  
  239. #if GENERATINGCFM
  240. #define CallExpModalFilterProc(userRoutine, theDialog, theEvent, itemOffset, itemHit, yourDataPtr)        \
  241.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppExpModalFilterProcInfo, (theDialog), (theEvent), (itemOffset), (itemHit), (yourDataPtr))
  242. #define CallExpDlgHookProc(userRoutine, itemOffset, itemHit, theDialog, yourDataPtr)        \
  243.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppExpDlgHookProcInfo, (itemOffset), (itemHit), (theDialog), (yourDataPtr))
  244. #else
  245. #define CallExpModalFilterProc(userRoutine, theDialog, theEvent, itemOffset, itemHit, yourDataPtr)        \
  246.         (*(userRoutine))((theDialog), (theEvent), (itemOffset), (itemHit), (yourDataPtr))
  247. #define CallExpDlgHookProc(userRoutine, itemOffset, itemHit, theDialog, yourDataPtr)        \
  248.         (*(userRoutine))((itemOffset), (itemHit), (theDialog), (yourDataPtr))
  249. #endif
  250.  
  251.  
  252. enum {
  253.     ioHasFormat,
  254.     ioReadFormat,
  255.     ioNewFormat,
  256.     ioWriteFormat
  257. };
  258.  
  259. typedef SignedByte FormatIOVerb;
  260.  
  261.  
  262. enum {
  263.     eoOpen,
  264.     eoClose,
  265.     eoOpenNew,
  266.     eoCloseNew,
  267.     eoCanSubscribe
  268. };
  269.  
  270. typedef SignedByte EditionOpenerVerb;
  271.  
  272. struct FormatIOParamBlock {
  273.     long                            ioRefNum;
  274.     FormatType                        format;
  275.     long                            formatIndex;
  276.     unsigned long                    offset;
  277.     Ptr                                buffPtr;
  278.     unsigned long                    buffLen;
  279. };
  280. typedef struct FormatIOParamBlock FormatIOParamBlock;
  281.  
  282. typedef struct EditionOpenerParamBlock EditionOpenerParamBlock;
  283.  
  284. typedef pascal short (*FormatIOProcPtr)(FormatIOVerb selector, FormatIOParamBlock *PB);
  285. typedef pascal short (*EditionOpenerProcPtr)(EditionOpenerVerb selector, EditionOpenerParamBlock *PB);
  286.  
  287. #if GENERATINGCFM
  288. typedef UniversalProcPtr FormatIOUPP;
  289. typedef UniversalProcPtr EditionOpenerUPP;
  290. #else
  291. typedef FormatIOProcPtr FormatIOUPP;
  292. typedef EditionOpenerProcPtr EditionOpenerUPP;
  293. #endif
  294.  
  295. struct EditionOpenerParamBlock {
  296.     EditionInfoRecord                info;
  297.     SectionHandle                    sectionH;
  298.     const FSSpec                    *document;
  299.     OSType                            fdCreator;
  300.     long                            ioRefNum;
  301.     FormatIOUPP                        ioProc;
  302.     Boolean                            success;
  303.     SignedByte                        formatsMask;
  304. };
  305. enum {
  306.     uppFormatIOProcInfo = kPascalStackBased
  307.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  308.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(FormatIOVerb)))
  309.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(FormatIOParamBlock*))),
  310.     uppEditionOpenerProcInfo = kPascalStackBased
  311.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  312.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(EditionOpenerVerb)))
  313.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(EditionOpenerParamBlock*)))
  314. };
  315.  
  316. #if GENERATINGCFM
  317. #define NewFormatIOProc(userRoutine)        \
  318.         (FormatIOUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppFormatIOProcInfo, GetCurrentArchitecture())
  319. #define NewEditionOpenerProc(userRoutine)        \
  320.         (EditionOpenerUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppEditionOpenerProcInfo, GetCurrentArchitecture())
  321. #else
  322. #define NewFormatIOProc(userRoutine)        \
  323.         ((FormatIOUPP) (userRoutine))
  324. #define NewEditionOpenerProc(userRoutine)        \
  325.         ((EditionOpenerUPP) (userRoutine))
  326. #endif
  327.  
  328.  
  329. enum {
  330.     sectionEventMsgClass        = 'sect',
  331.     sectionReadMsgID            = 'read',
  332.     sectionWriteMsgID            = 'writ',
  333.     sectionScrollMsgID            = 'scrl',
  334.     sectionCancelMsgID            = 'cncl'
  335. };
  336.  
  337. enum {
  338.     currentEditionMgrVers        = 0x0011
  339. };
  340.  
  341. #if !CFMSYSTEMCALLS
  342. extern pascal OSErr InitEditionPack(void)
  343.  FIVEWORDINLINE(0x3F3C, 0x0011, 0x303C, 0x0100, 0xA82D);
  344. #else
  345. #define InitEditionPack() InitEditionPackVersion(currentEditionMgrVers)
  346. extern pascal OSErr InitEditionPackVersion(short curEditionMgrVers)
  347.  THREEWORDINLINE(0x303C, 0x0100, 0xA82D);
  348. #endif
  349. extern pascal OSErr NewSection(const EditionContainerSpec *container, ConstFSSpecPtr sectionDocument, SectionType kind, long sectionID, UpdateMode initalMode, SectionHandle *sectionH)
  350.  THREEWORDINLINE(0x303C, 0x0A02, 0xA82D);
  351. extern pascal OSErr RegisterSection(const FSSpec *sectionDocument, SectionHandle sectionH, Boolean *aliasWasUpdated)
  352.  THREEWORDINLINE(0x303C, 0x0604, 0xA82D);
  353. extern pascal OSErr UnRegisterSection(SectionHandle sectionH)
  354.  THREEWORDINLINE(0x303C, 0x0206, 0xA82D);
  355. extern pascal OSErr IsRegisteredSection(SectionHandle sectionH)
  356.  THREEWORDINLINE(0x303C, 0x0208, 0xA82D);
  357. extern pascal OSErr AssociateSection(SectionHandle sectionH, const FSSpec *newSectionDocument)
  358.  THREEWORDINLINE(0x303C, 0x040C, 0xA82D);
  359. extern pascal OSErr CreateEditionContainerFile(const FSSpec *editionFile, OSType fdCreator, ScriptCode editionFileNameScript)
  360.  THREEWORDINLINE(0x303C, 0x050E, 0xA82D);
  361. extern pascal OSErr DeleteEditionContainerFile(const FSSpec *editionFile)
  362.  THREEWORDINLINE(0x303C, 0x0210, 0xA82D);
  363. extern pascal OSErr OpenEdition(SectionHandle subscriberSectionH, EditionRefNum *refNum)
  364.  THREEWORDINLINE(0x303C, 0x0412, 0xA82D);
  365. extern pascal OSErr OpenNewEdition(SectionHandle publisherSectionH, OSType fdCreator, ConstFSSpecPtr publisherSectionDocument, EditionRefNum *refNum)
  366.  THREEWORDINLINE(0x303C, 0x0814, 0xA82D);
  367. extern pascal OSErr CloseEdition(EditionRefNum whichEdition, Boolean successful)
  368.  THREEWORDINLINE(0x303C, 0x0316, 0xA82D);
  369. extern pascal OSErr EditionHasFormat(EditionRefNum whichEdition, FormatType whichFormat, Size *formatSize)
  370.  THREEWORDINLINE(0x303C, 0x0618, 0xA82D);
  371. extern pascal OSErr ReadEdition(EditionRefNum whichEdition, FormatType whichFormat, void *buffPtr, Size *buffLen)
  372.  THREEWORDINLINE(0x303C, 0x081A, 0xA82D);
  373. extern pascal OSErr WriteEdition(EditionRefNum whichEdition, FormatType whichFormat, const void *buffPtr, Size buffLen)
  374.  THREEWORDINLINE(0x303C, 0x081C, 0xA82D);
  375. extern pascal OSErr GetEditionFormatMark(EditionRefNum whichEdition, FormatType whichFormat, unsigned long *currentMark)
  376.  THREEWORDINLINE(0x303C, 0x061E, 0xA82D);
  377. extern pascal OSErr SetEditionFormatMark(EditionRefNum whichEdition, FormatType whichFormat, unsigned long setMarkTo)
  378.  THREEWORDINLINE(0x303C, 0x0620, 0xA82D);
  379. extern pascal OSErr GetEditionInfo(SectionHandle sectionH, EditionInfoRecord *editionInfo)
  380.  THREEWORDINLINE(0x303C, 0x0422, 0xA82D);
  381. extern pascal OSErr GoToPublisherSection(const EditionContainerSpec *container)
  382.  THREEWORDINLINE(0x303C, 0x0224, 0xA82D);
  383. extern pascal OSErr GetLastEditionContainerUsed(EditionContainerSpec *container)
  384.  THREEWORDINLINE(0x303C, 0x0226, 0xA82D);
  385. extern pascal OSErr GetStandardFormats(const EditionContainerSpec *container, FormatType *previewFormat, Handle preview, Handle publisherAlias, Handle formats)
  386.  THREEWORDINLINE(0x303C, 0x0A28, 0xA82D);
  387. extern pascal OSErr GetEditionOpenerProc(EditionOpenerUPP *opener)
  388.  THREEWORDINLINE(0x303C, 0x022A, 0xA82D);
  389. extern pascal OSErr SetEditionOpenerProc(EditionOpenerUPP opener)
  390.  THREEWORDINLINE(0x303C, 0x022C, 0xA82D);
  391. extern pascal OSErr CallEditionOpenerProc(EditionOpenerVerb selector, EditionOpenerParamBlock *PB, EditionOpenerUPP routine)
  392.  THREEWORDINLINE(0x303C, 0x052E, 0xA82D);
  393. extern pascal OSErr CallFormatIOProc(FormatIOVerb selector, FormatIOParamBlock *PB, FormatIOUPP routine)
  394.  THREEWORDINLINE(0x303C, 0x0530, 0xA82D);
  395. extern pascal OSErr NewSubscriberDialog(NewSubscriberReply *reply)
  396.  THREEWORDINLINE(0x303C, 0x0232, 0xA82D);
  397. extern pascal OSErr NewSubscriberExpDialog(NewSubscriberReply *reply, Point where, short expansionDITLresID, ExpDlgHookUPP dlgHook, ExpModalFilterUPP filter, void *yourDataPtr)
  398.  THREEWORDINLINE(0x303C, 0x0B34, 0xA82D);
  399. extern pascal OSErr NewPublisherDialog(NewPublisherReply *reply)
  400.  THREEWORDINLINE(0x303C, 0x0236, 0xA82D);
  401. extern pascal OSErr NewPublisherExpDialog(NewPublisherReply *reply, Point where, short expansionDITLresID, ExpDlgHookUPP dlgHook, ExpModalFilterUPP filter, void *yourDataPtr)
  402.  THREEWORDINLINE(0x303C, 0x0B38, 0xA82D);
  403. extern pascal OSErr SectionOptionsDialog(SectionOptionsReply *reply)
  404.  THREEWORDINLINE(0x303C, 0x023A, 0xA82D);
  405. extern pascal OSErr SectionOptionsExpDialog(SectionOptionsReply *reply, Point where, short expansionDITLresID, ExpDlgHookUPP dlgHook, ExpModalFilterUPP filter, void *yourDataPtr)
  406.  THREEWORDINLINE(0x303C, 0x0B3C, 0xA82D);
  407.  
  408. #if PRAGMA_IMPORT_SUPPORTED
  409. #pragma import off
  410. #endif
  411.  
  412. #if PRAGMA_ALIGN_SUPPORTED
  413. #pragma options align=reset
  414. #endif
  415.  
  416. #ifdef __cplusplus
  417. }
  418. #endif
  419.  
  420. #endif /* __EDITIONS__ */
  421.